package com.bjsxt.controller;


import com.bjsxt.pojo.HostPower;
import com.bjsxt.pojo.Result;
import com.bjsxt.service.IHostPowerService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author ${author}
 * @since 2022-02-22
 */
@Controller
@RequestMapping("/hostPower")
public class HostPowerController {
    //声明业务层属性
    @Autowired
    private IHostPowerService hostPowerService;
    //声明单元方法：处理权限的更新
    @ResponseBody
    @RequestMapping("hostPowerOper")
    public Result hostPowerOper(HostPower hostPower){
        //处理请求
        boolean b1 = hostPower.getHpid() == null ? hostPower.insert() : hostPower.updateById();
        //响应结果
        return new Result(b1, b1 ? "权限更新成功":"权限更新失败");
    }
    //声明单元方法：处理批量权限操作
    @ResponseBody
    @RequestMapping("hostPowerBatchOper")
    public Result hostPowerBatchOper(String hostids,HostPower hostPower){
        System.out.println(hostPower);
        //请求处理
        Result result=hostPowerService.delInsHostPowerBatchService(hostids,hostPower);
        //处理响应
        return result;
    }
}

